<!DOCTYPE html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加新商品</title>
    <meta name="description" content="后台管理">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="__CSS__/amazeui.min.css"/>
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__JS__/easyUpload/easyUpload.css"/>
    <script src="__JS__/jquery.min.js"></script>
    <script src="__JS__/app.js"></script>
    <script src="__JS__/easyUpload/vendor/jquery.cookie-1.4.1.min.js"></script>
    <script src="__JS__/easyUpload/easyUpload.js"></script>
</head>

<body>
{include file="common/header" /}
<div class="am-cf admin-main">
    {include file="common/menu" /}
    <div class=" admin-content">

        <div class="daohang">

        </div>


        <div class="admin-biaogelist">

            <div class="listbiaoti am-cf">
                <ul class="am-icon-flag on"> 栏目名称</ul>

                <dl class="am-icon-home" style="float: right;"> 当前位置： <a href="#">添加新商品</a></dl>


            </div>

            <div class="fbneirong">
                <form class="am-form" id="form" method="post" action="{:url('goods_add')}" enctype="multipart/form-data">
                    <div class="am-form-group am-cf">
                        <div class="zuo">产品型号：</div>
                        <div class="you">
                            <input type="text" class="am-input-sm" name="model" placeholder="请输入产品型号">
                        </div>
                    </div>
                    <!--<div class="am-form-group am-cf">-->
                    <!--<div class="zuo">描述：</div>-->
                    <!--<div class="you">-->
                    <!--<textarea class="" rows="2" id="doc-ta-1"></textarea>-->
                    <!--</div>-->
                    <!--</div>-->
                    <!--<div class="am-form-group am-cf">-->
                    <!--<div class="zuo">缩略图：</div>-->
                    <!--<div class="you"><input type="file" id="doc-ipt-file-1"> </div>-->
                    <!--</div>-->

                    <div class="am-form-group am-cf">
                        <div class="zuo">产品图片：</div>
                        <div class="you" id="images-box">
                            <!--<p style="position:relative;">-->
                            <!--<input type="file" name="images[]" style="margin: 5px 0;">-->
                            <!--<button type="button" class="del" style="position:absolute; right: 0;top:0;">删除</button>-->
                            <!--</p>-->
                            <div id="easyContainer"></div>
                        </div>
                    </div>


                    <script>

                        $('#easyContainer').easyUpload({
                            allowFileTypes: '*.jpg;*.png;*.gif',//允许上传文件类型，格式';*.doc;*.pdf'
                            allowFileSize: 100000,//允许上传文件大小(KB)
                            selectText: '选择文件',//选择文件按钮文案
                            multi: true,//是否允许多文件上传
                            multiNum: 50,//多文件上传时允许的文件数
                            showNote: true,//是否展示文件上传说明
                            note: '提示：最多上传50个文件，支持格式为jpg、png、gif',//文件上传说明
                            showPreview: true,//是否显示文件预览
                            url: '{:url("index/image_upload")}',//上传文件地址
                            fileName: 'file',//文件filename配置参数
                            formParam: {
                                //token: $.cookie('token_cookie')//不需要验证token时可以去掉
                            },//文件filename以外的配置参数，格式：{key1:value1,key2:value2}
                            timeout: 30000,//请求超时时间
                            successFunc: function (res, obj) {
                                console.log('成功回调', res, obj);
                                var html = '<input type="hidden" name="path[]" class="path" value="' + res['path'] + '">';
                                obj.ele.append(html);
                            },//上传成功回调函数
                            errorFunc: function (res) {
                                console.log('失败回调', res);
                            },//上传失败回调函数
                            deleteFunc: function (res) {
                                console.log('删除回调', res);
                            }//删除文件回调函数
                        });
                    </script>
                    <div class="am-form-group am-cf">
                        <div class="you" style="margin-left: 11%;">
                            <button type="submit" class="am-btn am-btn-success am-radius">发布商品</button>
                        </div>
                    </div>
                    <script>
                        $('#form').submit(function(){
                            var model = $('[name=model]').val();
                            if(!model){
                                alert('型号不能为空！');
                                return false;
                            }else if($('.path').length == 0){
                                alert('请上传图片再发布！');
                                return false;
                            }

                            return true;
                        });
                    </script>
                </form>
            </div>
            {include file="common/footer" /}
        </div>
    </div>

</body>
</html>